/*
Copyright SecureKey Technologies Inc. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0
*/

package balancer

import (
	"git.cloud.inspur.com/ichain/ichain-sdk-go/pkg/common/balancer/random"
	"git.cloud.inspur.com/ichain/ichain-sdk-go/pkg/common/balancer/roundrobin"
	"git.cloud.inspur.com/ichain/ichain-sdk-go/pkg/providers/ichain"
)

type Balancer interface {
	Choose([]ichain.Inode) (ichain.Inode, error)
}

func GetBalancer(policy ichain.EventServicePolicy) Balancer {
	switch policy.Balancer {
	case ichain.RoundRobin:
		return roundrobin.NewBalancer()
	case ichain.Random:
		return random.NewBalancer()
	default:
		return random.NewBalancer()
	}
}
